function Move(x, y, direction)
	if (direction == 0) then
		x = x + 1
		return x
	end

	if(direction == 1) then
		y = y + 1
		return y
	end

	if(direction == 2) then
		x = x - 1
		return x
	end

	if(direction == 3) then
		y = y - 1
		return y
	end

end


function CheckDirection(right, down, left, up, direction)

	if(direction == 1) then
		if(right == 1) then
			return 1
		else
			return 0
		end
	end

	if(direction == 2) then
		if(down == 1) then
			return 1
		else
			return 0
		end
	end

	if(direction == 3) then
		if(left == 1) then
			return 1
		else
			return 0
		end
	end

	if(direction == 4) then
		if(up == 1) then
			return 1
		else
			return 0
		end
	end

end
